package com.codechuan.hallo_internal.thread;


import com.codechuan.hallo_internal.common.Constant;
import com.codechuan.hallo_internal.entity.CityInfo;
import com.codechuan.hallo_internal.utils.HalloProjectHttpUtil;

/**
 * 生成订单线程
 */
public class ObtainOrderThread implements Runnable {
    SynContainer synContainer;
    CityInfo cityInfo;

    public ObtainOrderThread(SynContainer synContainer, CityInfo cityInfo) {
        this.synContainer = synContainer;
        this.cityInfo = cityInfo;
    }

    @Override
    public void run() {
        String name = Thread.currentThread().getName();

        while (Constant.isStart) {
            if (Constant.APP_IS_CHECK) {
                // 获取App大厅订单接口
                HalloProjectHttpUtil.getWeChatAppProgramOrderList(cityInfo, synContainer,name);
            } else {
                // 判断是否是行程刷单
                if (Constant.XC_ORDER) {
                    // todo 获取小程序行程订单接口
                } else {
                    // 获取小程序大厅订单接口
                    HalloProjectHttpUtil.getWeChatMiniProgramOrderListTwo(cityInfo, synContainer);
                }
            }
            try {
                Thread.sleep(7000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
        System.out.println(name + "子线程关闭");
    }
}